package com.summer.shopping.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.summer.shopping.domain.table.SecondaryCategory;
import com.summer.shopping.domain.table.dto.SecondaryDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName:
 * Package:
 * Description:
 *
 * @Author: 陈三岁
 * @Create
 * @Version
 */

public interface SecondaryCgMapper extends BaseMapper<SecondaryCategory> {

    /**
     * 二级分类名称查询
     * @param
     * @return
     */
    @Select("select * from secondary_category where parent_id = #{parentId}")
    List<SecondaryCategory> selectAllSCg(Long parentId );

    @Insert("insert into secondary_category(name, parent_id) VALUES (#{name},#{parentId})")
    void save(SecondaryDTO secondaryDTO);

    @Select("select * from secondary_category where id = #{id}")
    SecondaryCategory getSCgById(Long id);
}
